

import engine.initLIB.load_dll as engineLib
import ctypes

import bpy
import 物体.物体管理.物体数据 as 网格数据

import pdb







g_动态物理体 = {}




def f_添加动态物理体(body):
	global g_动态物理体
	#if body.m_物体ID in g_动态物理体 == False :
	print('body = ', body)
	#g_动态物理体[body.m_物体ID] = body








def f_添加物体到引擎(obj, 构建数据=True):
	key = 0

	if 构建数据 :
		if obj.type == 'MESH' :
			key = f_添加网格物体到引擎(obj)
		elif obj.type == 'Empty' :
			key = f_添加虚拟物体到引擎(obj)
	else:
		key = f_添加虚拟物体到引擎(obj)
		
	return key






def f_添加网格物体到引擎(obj):
	data = 网格数据.f_get物体网格数据(obj=obj, context=bpy.context)
	key = engineLib.flexCAPI.f_add模型(ctypes.c_uint32(obj.m_物体ID), ctypes.py_object(data))
	obj.m_物体ID = key
	#print('obj.type == key A = ', key, obj)
	return key




def f_添加虚拟物体到引擎(obj):
	key = engineLib.flexCAPI.f_add虚拟物体(ctypes.c_uint32(obj.m_物体ID))
	obj.m_物体ID = key
	print('obj.type == key B = ', key, obj)
	return key









